package org.mosquitos.chat;

import net.jxta.endpoint.EndpointService;
import net.jxta.peergroup.PeerGroup;

public class ReceiveService implements Runnable {
	private PeerGroup npg;
	
	public ReceiveService(PeerGroup npg){
		this.npg = npg;
	}

	public void run() {
		EndpointService es = npg.getEndpointService();
		
		while(true){
			es.addIncomingMessageListener(new ReceiveListener(),"chatService", null);
			
	        synchronized (this){
		        try {
					this.wait(1*2*1000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
	        }
		}
		//Message announce = new Message();
	}

}
